package com.jy.admin.db.dao.impl;

import com.fqgj.common.api.Page;
import com.fqgj.common.base.AbstractBaseMapper;
import com.jy.admin.db.dao.SmsSendLogDao;
import com.jy.admin.db.entity.SmsSendLogEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * User: anonymous
 * Date: 2021-12-10
 * Time: 14:58:47.138
 */

@Repository
public class SmsSendLogDaoImpl extends AbstractBaseMapper<SmsSendLogEntity> implements SmsSendLogDao {

    @Override
    public SmsSendLogEntity selectByTag(String tag) {
        Map<String, Object> params = new HashMap<>();
        params.put("tag", tag);
        return getSqlSession().selectOne(this.getStatement("selectByTag"), params);
    }

    @Override
    public List<SmsSendLogEntity> selectListByStatusAndPage(String taskNo,Integer status, Page page) {
        Map<String, Object> params = new HashMap<>();
        params.put("page", page);
        params.put("status", status);
        params.put("taskNo", taskNo);
        return getSqlSession().selectList(this.getStatement("selectListByStatusAndPage"), params);
    }

    @Override
    public void updateBatchSendResult(List<Long> ids, Integer status, String res) {
        Map<String, Object> params = new HashMap<>();
        params.put("ids", ids);
        params.put("status", status);
        params.put("res", res);
        getSqlSession().update(this.getStatement("updateBatchSendResult"), params);
    }
}